* {
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;

  body,
  #app {
    height: 100%;
  }
}

body {
  background-color: #f7f8fa;
  font-family: -apple-system;
  font-size: var(--d-font-size-sm);
  color: var(--d-primary-text-color);
}

// webkit内核滚动条全局样式处理
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background-color: transparent;
  transition: background-color 0.3s;
  border-radius: 4px;
  cursor: pointer;
}

*::-webkit-scrollbar-corner {
  background-color: transparent;
}

*:hover::-webkit-scrollbar-thumb {
  background-color: rgba(144, 147, 153, 0.3);
  transition: background-color 0.3s;
}

a {
  color: var(--d-primary);
}

img {
  max-width: 100%;
  max-height: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: initial;
}

blockquote {
  position: relative;
  box-sizing: border-box;
  margin-top: var(--d-gap-sm);
  padding: var(--d-gap-sm);
  border-radius: 5px;
  background: #f2f4f5 !important;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--d-primary);
  }
}

// 文档预览样式
.d-doc {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0 auto;
  font-size: var(--d-font-size-md);
  line-height: var(--d-line-height-lg);

  &__header {
    display: flex;
    height: 50px;
    padding: var(--d-gap-xs) var(--d-gap-sm);
    overflow: hidden;
    background: #fff;

    img {
      height: calc(50px - calc(var(--d-gap-xs) * 2));
      margin-right: var(--d-gap-xs);
      vertical-align: middle;
    }

    h1 {
      display: inline-block;
      vertical-align: middle;
      font-size: 20px;
    }

    &-right {
      flex: 1;
    }
  }

  &__out-content {
    flex: 1;
    display: flex;
    width: 100%;
    overflow: hidden;
  }

  &__menu {
    width: 200px;
    height: 100%;
    padding: var(--d-gap-sm);
    background: #fff;
    overflow-y: auto;
  }

  &--mobile {
    height: 100%;
    padding: 0;
  }

  &__demo-mobile {
    position: fixed;
    top: 50%;
    right: var(--d-gap-sm);
    width: 375px;
    min-width: 375px;
    height: 600px;
    border: var(--d-border);
    transform: translateY(-50%);
  }

  &__scroll {
    height: 100%;
    padding: var(--d-gap-sm);
    overflow-y: auto;
    background: #fff;
  }

  &__inner-content {
    flex: 1;
    max-width: calc(100% - 200px - calc(var(--d-gap-sm) * 1));
    padding: var(--d-gap-sm);
    overflow: hidden;
    line-height: initial;

    li {
      padding: 4px 0;
      list-style-type: initial;
      list-style-position: inside;

      ul,
      ol {
        padding-left: var(--d-gap-md);
      }
    }

    $h3-font-size: 18px;
    @for $num from 1 through 6 {
      h#{$num} {
        border: 0;

        & + p {
          margin-top: var(--d-gap-xs);
        }

        @if $num != 1 {
          margin: var(--d-gap-lg) 0 var(--d-gap-xs);
        }

        @if $num > 2 {
          font-size: $h3-font-size - 2px * ($num - 3);
        }
      }
    }

    h1 {
      font-size: 28px;
    }

    h2 {
      font-size: 24px;
    }

    table {
      width: 100%;
      border: var(--d-border);
      border-collapse: collapse;

      & + * {
        margin-top: var(--d-gap-md);
      }

      thead {
        background-color: var(--d-border-color);
      }

      tr {
        th {
          padding: var(--d-gap-xs);
          border-bottom: var(--d-border);
          text-align: left;
          color: rgba(0, 0, 0, 0.9);

          &:nth-of-type(4) {
            width: 40%;
          }
        }

        td {
          padding: var(--d-gap-xs);

          &:first-of-type {
            font-weight: bold;
          }

          &:nth-of-type(4) {
            width: 40%;
          }
        }
      }
    }

    code:not(&__preview code, pre code) {
      margin: 0 1px;
      padding: 0.2em 0.4em;
      font-size: 0.9em;
      background: #f2f4f5;
      border: 1px solid rgba(0, 0, 0, 0.06);
      border-radius: 3px;
    }
  }
}

.shiki {
  box-sizing: border-box;
  margin-top: var(--d-gap-sm);
  padding: var(--d-gap-sm);
  border-radius: 5px;
  background: #f2f4f5 !important;
}
